const should = require('chai').Should()
const expect = require('chai').expect

const Rate = require('../classes/Rate')
const Stay = require('../classes/Stay')
const Calculator = require('../classes/Calculator')

describe('Calculator', () => {

  const rate = new Rate({
    regular: 200,
    regularWeekend: 100,
    loyalty: 100,
    loyaltyWeekend: 50
  })

  const stay = new Stay('Rewards: 20Mar2009(fri), 21Mar2009(sat), 22Mar2009(sun)')
  const regularStay = new Stay('Regular: 20Mar2009(fri), 21Mar2009(sat), 22Mar2009(sun)')

  const calculator = new Calculator()

  it('Deve retornar o preço final de um orçamento', () => {
    const finalBudget = calculator.calculateBudget(stay, rate)
    expect(finalBudget).to.equal(200)
  })

  it('Deve calcular o preço de acordo com o tipo do cliente ', () => {
    const price = calculator.calculatePrice(regularStay, rate.getPriceWeek(), rate.getPriceWeekend())
    expect(price).to.equal(400)
  })
 
  it('Deve calcular preço', () => {
    const finalPrice = calculator.calculate(stay, 200, 100)
    expect(finalPrice).to.equal(400)
  })

  it('Deve verificar se o cliente é regular', () => {
    const clientType = calculator.isRegularClient(stay.getClientType())
    expect(clientType).to.equal(false)
  })

})